import { history, getDvaApp } from 'umi';
import { getQueryValue, getEnvURL } from '@/utils/utils';
import { baseRender } from '@/utils/base/app.js';
const iscRender = (oldRender) => {
  const ticket = getQueryValue('ticket');
  const tokens = sessionStorage.getItem('author');
  if (!ticket && !tokens) {
    window.location.href = getEnvURL();
  } else {
    const { search } = window.location;
    const devUrl = `/${search}`;
    history.push(devUrl);
    oldRender();
  }
};

export function render(oldRender) {
  switch (process.env.SYSTEM) {
    case 'base':
      baseRender(oldRender);
      break;
    default:
      iscRender(oldRender);
      break;
  }
}
